﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <link href="./css/tie.css" rel="stylesheet" type="text/css" />    
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
    <title>Página de Actividades</title>    
</head>
<body>
    <table id="form_canvas" class="MyMatrix_canvas">
        <tr>
            <td>
                <!-- HEADER CONTENT /-->
                <table id="MyMatrix_header" class="MyMatrix_header">
                    <!-- First header table row /-->
                    <tr>
                        <td id="MyMatrix_headerDate">
                            <div id="MyMatrix_header_currentdate">
                                <script type="text/javascript" src="scripts/date.js"></script>
                            </div>
                        </td>
                        <td id="MyMatrix_tracker">
                            <script src="scripts/writePath.js" type="text/javascript"></script>
                            <div style="float: right">
                                <a href="{{ URL }}">{{ URL_LinkText }}</a> {{User.nickname}}{{user}}</div>
                        </td>
                    </tr>
                    <!-- Second header table row /-->
                    <tr>
                        <td>
                            <div style="float: left;">
                                <img alt="" src="images/TieLogo.png" class="Logo" /></div>
                        </td>
                        <td>
                            <table class="boxNav" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td class="celNavLeft">
                                    </td>
                                    <td width="10px">
                                        &nbsp;
                                    </td>
                                    <td id="MyMatrix_menu_1" class="celNavMenu">
                                        <a href="/loadactivities">Actividades</a>
                                    </td>
                                    <td width="50">
                                        &nbsp;
                                    </td>                                    
                                    <td id="Td2" class="celNavMenu">
                                        <a href="/loadroutes">Rotas</a>
                                    </td>                                    
                                    <td width="10">
                                        &nbsp;
                                    </td>
                                    <td id="MyMatrix_menu_2" class="celNavMenu">
                                        <a href="/loadentities">Entidades</a>
                                    </td>
                                    <td width="10">
                                        &nbsp;
                                    </td>
                                    <td id="MyMatrix_menu_3" class="celNavMenu">
                                        <a href="/loadcontacts">Contactos</a>
                                    </td>
                                    <td width="10">
                                        &nbsp;
                                    </td>
                                    <td class="celNavRight">
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <!-- BODY CONTENT /-->
                <table id="MyMatrix_body" class="MyMatrix_body">
                    <tr>
                        <td>
                            <div id="content">
                                <table>
                                    <tr>
                                        <td valign="top">
                                            <span class="title">Actividades</span>
                                            <br /><br />
                                            <span class="titleHighlight">Gestão de actividades</span>
                                            <br /><br />
                                        </td>
                                    </tr>
                                </table>
                                <table border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td class="celSepHColorLeft"/>
                                        <td class="celSepHColorCenter"/>
                                        <td class="celSepHColorRight"/>
                                    </tr>
                                </table>
                                {% if NumberActivities %}
                                <table class="ListTable">
                                    <tr>
                                        <th>Editar</th>
                                        <th>Resumo</th>
                                        <th>Data Activ.</th>
                                        <th>Actividade</th>
                                        <th>Entidade</th>
                                        <th>Contacto</th>
                                        <th>Prioridade</th>
                                        <th>Criado</th>
                                        <th>Fechado</th>
                                    </tr>
                                    {% for activity in Activities %}
                                    <tr>
                                        <td><a class="MyLink" href="/loadactivities?id={{activity.key.id}}">editar</a></td>
                                        <td>
                                            {{activity.shortDescription}}
                                        </td>
                                        <td>
                                            {{activity.dueDate|date:"d.m.Y"}}
                                        </td>
                                        <td>
                                            {{activity.activity}}
                                        </td>
                                        <td><a class="MyLink" href="/loadentities?id={{activity.entityCode.key.id}}">{{activity.entityCode.EntityAbbr}}</a></td>
                                        <td><a class="MyLink" href="/loadcontacts?id={{activity.contact.key.id}}">{{activity.contact.Name}}</a></td>
                                        <td>
                                            {{activity.priority}}
                                        </td>
                                        <td>
                                            {{activity.created|date:"d.m.Y"}}
                                        </td>
                                        <td>
                                            <a class="MyLink"  href="/doneActivity?id={{activity.key.id}}">Fechar</a>
                                        </td>
                                    </tr>
                                    {% endfor %}
                                </table>
                                <hr />
                                <p style="text-align:right; font-size:smaller">
                                    Número total de actividades: {{NumberActivities}}
                                </p>
                                {% endif %}                                                                
                                <div class="headline">
                                    <p class="subtitle">Criar/editar actividades</p> </div>
                                {% if user %}
                                <form style="width:100%" action="{{Action}}" method="post">
                                <table class="EditTable">
                                    <tr>
                                        <td class="EditTable_Col1"><label for="entityCode">Entidade</label>
                                        </td>
                                        <td class="EditTable_Col2">
                                            <select class="EditField" name="entityCode" id="entityCode" onchange="window.location.href='/loadactivities?id={{edActivity.key.id}}&entityAbbr=' + this.options[this.selectedIndex].value">
                                                {{listEntities}}
                                            </select>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="EditTable_Col1"><label for="contact">Contacto</label></td>
                                        <td class="EditTable_Col2">
                                            <select class="EditField" name="contact" id="contact">
                                                {{listContacts}}
                                            </select>                                        
                                        </td>
                                    </tr>
                                    <tr><td>&nbsp</td></tr>                                
                                    <tr>
                                        <td class="EditTable_Col1"><label for="shortDescription">Resumo</label></td>
                                        <td class="EditTable_Col2" colspan="2"><input class="EditField" type="text" name="shortDescription" id="shortDescriptions" value="{{edActivity.shortDescription}}"/></td>
                                        
                                    </tr>
                                    <tr>
                                        <td class="EditTable_Col1"><label for="activity">Tipo</label></td>
                                        <td class="EditTable_Col2">
                                            <select class="EditField" name="activity" id="activity">
                                                {{listTypeActivity}}
                                            </select>                                                                                                                      
                                        </td>
                                        <td class="EditTable_Col3"></td>
                                        <td class="EditTable_Col4"></td>
                                        <td class="EditTable_Col5"></td>
                                    </tr>       
                                    <tr>
                                        <td class="EditTable_Col1"><label for="priority">Prioridade</label></td>
                                        <td class="EditTable_Col2">
                                            <select class="EditField" name="priority" id="priority">
                                                {{listPriorities}}
                                            </select>                                           
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="EditTable_Col1"><label for="dueDate">Data</label></td>
                                        <td class="EditTable_Col2">
                                            <input class="EditField" type="text" name="dueDate" id="dueDate" value='{{edActivity.dueDate|date:"d/m/Y"}}'/>
                                        </td>
                                        <td class="EditTable_Col3">(dd/mm/aaaa)</td>
                                    </tr>
                                    <tr>
                                        <td class="EditTable_Col1" valign="top"><label for="longDescription">Descrição</label></td>
                                        <td class="EditTable_Col2" colspan="5">
                                            <input class="EditField" rows="4" cols="80" type="text" name="longDescription" id="longDescription" value="{{edActivity.longDescription}}"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="5" align="right">
                                        {% if EditMode %} 
                                            <input type="submit" value="Actualizar actividade" />
                                            <a href="/deleteactivity?id={{edActivity.key.id}}" runat="server">Eliminar</a>
                                        {% else %} 
                                            <input type="submit" value="Criar actividade" />
                                        {% endif%}   
                                        </td>
                                    </tr>
                                </table>
                                </form>
                                {% else %} 
                                    Valide-se com o seu login para ver ou manusear as actividades. 
                                {% endif%}
                            </div>
                        </td>
                    </tr>
                </table>
                <!-- FOOTER CONTENT -->
                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td id="Td1" class="MyMatrix_footer">
                                <script src="scripts/PageLayout.js" type="text/javascript"></script>                            
                        </td>
                    </tr>
                </table>
                <!-- BASEBOARD-->
                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="boxBaseboard">
                    <tr>
                        <td class="baseboard_left">
                            &nbsp;
                        </td>
                        <td class="baseboard_center">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="baseboard_txt">
                                <tr>
                                    <td style="text-align: left; width: 140px;">
                                        <img src="images/IPCALogo.png" alt="IPCA Logo" />
                                    </td>
                                    <td>
                                        <b>(Nuno Queirós - António Antunes - Miguel Barroso)
                                            <br />

                                            <script type="text/javascript" src="./Scripts/Year.js"></script>

                                            © IPCA</b> . Todos os Direitos Reservados.
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td class="baseboard_right">
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</body>
</html>
